//
//  SZMineMainController.m
//  KaiJing
//
//  Created by lanou on 16/1/11.
//  Copyright © 2016年 HuangZuCui. All rights reserved.
//

#import "SZMineMainController.h"
#import "SZMineMainHeaderVew.h"
#import "SZLoginViewController.h"


// 按钮高度
#define kButtonHeight 50
@interface SZMineMainController ()
/** cell数据源 */
@property (nonatomic, strong) NSArray *dataSource;
@end

@implementation SZMineMainController

- (void)viewDidLoad {
    [super viewDidLoad];
#warning 判断是否登录
    SZLoginViewController *loginVC = [[SZLoginViewController alloc] init];
    UINavigationController *loginNav = [[UINavigationController alloc] initWithRootViewController:loginVC];
    [self presentViewController:loginNav animated:YES completion:nil];
    
    
    
    // 初始化数据源
    _dataSource = @[@"我的提醒", @"我赞过的", @"我的沙龙", @"我的位置"];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"SZMineMainCell"];
    [self addHeaderTableView];
}

// 添加表头
- (void)addHeaderTableView {
    SZMineMainHeaderVew *headerView = [[SZMineMainHeaderVew alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kButtonHeight)];
    self.tableView.tableHeaderView = headerView;
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _dataSource.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SZMineMainCell" forIndexPath:indexPath];
    cell.textLabel.text = _dataSource[indexPath.row];
    cell.imageView.image = [UIImage imageNamed:@"mine_selected"];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // 选中了我的位置
    
}
@end
